#include<iostream>
using namespace std;
#include<unistd.h>
#include<sys/types.h>
#include<sys/wait.h>
#include<fcntl.h>
#include<cstring>
#include<sys/stat.h>
#include<errno.h>
#include<string>
#include<cassert>
#include<time.h>


#define PATH_NAME "./zq_namepipe"
#define PATH_NAME2 "./zq_namepipe2"
#define NUM_COMPARE 120


bool creatfifo(const string& path){
    umask(0);
    int ret = mkfifo(path.c_str(),0666);
    if(ret == 0) return true;
    else{
        cout<<"errno:"<<errno<<"string err:"<<strerror(errno)<<endl;
        return false;
    }
}


void removefifo(const string& path){
    int ret = unlink(path.c_str());
    assert(ret == 0);
    (void)ret;
}

void makeseek(){
    srand(time(nullptr));
}

//0：石头。1：剪刀。2：布
//a:1 b:-1
char judge(char a,char b){
    if(a == b){
        return 0;
    }else{
        if(a=='0'&&b=='1')
            return '1';
        if(a=='0'&&b=='2')
            return '2';
        if(a=='1'&&b=='2')
            return '1';
        if(a=='1'&&b=='0')
            return '2';
        if(a=='2'&&b=='0')
            return '1';
        if(a=='2'&&b=='1')
            return '2';
    }
}